package com.itheima.app.controller;

import com.itheima.app.manager.SoundManager;
import com.itheima.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class SoundController {
    @Autowired
    private SoundManager soundManager;

    //桃花传音-发送语音
    @PostMapping("/peachblossom")
    public void sendSound(MultipartFile soundFile) throws IOException {
        soundManager.sendSound(soundFile);
    }

    //桃花传音-接受语音
    @GetMapping("/peachblossom")
    public SoundVo getSound(){
        return soundManager.getSound();
    }
}
